package globals;

import java.util.ArrayList;
import java.util.List;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Image;
import org.newdawn.slick.Music;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.Sound;
import org.newdawn.slick.TrueTypeFont;
import org.newdawn.slick.state.StateBasedGame;

public class GlobalResources {
	private static ArrayList<Pair<TrueTypeFont>> FontList;
	private static ArrayList<Pair<Image>> ImageList;
	private static ArrayList<Pair<Sound>> SFXList;
	private static ArrayList<Pair<Music>> MusicList;
	
	public GlobalResources(){
		FontList=new ArrayList<Pair<TrueTypeFont>>();
		ImageList=new ArrayList<Pair<Image>>();
		SFXList= new ArrayList<Pair<Sound>>();
		MusicList=new ArrayList<Pair<Music>>();
	}
	
	public static void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
		FontList.add(new Pair<TrueTypeFont>("FontLarge",new TrueTypeFont(new java.awt.Font("Times New Roman",0,48), true)));
		FontList.add(new Pair<TrueTypeFont>("FontNormal",new TrueTypeFont(new java.awt.Font("Times New Roman",0,32), true)));
		FontList.add(new Pair<TrueTypeFont>("FontSmall",new TrueTypeFont(new java.awt.Font("Times New Roman",0,20), true)));
	}
	
	public static void destroy(){
		FontList.clear();
		ImageList.clear();
		SFXList.clear();
		MusicList.clear();
	}
	
	public static TrueTypeFont getFont(String fontName){
		
		for(int i=0; i<FontList.size();i++){
			if(fontName==FontList.get(i).getName()){
				System.out.println("GlobalResources - Resource "+fontName+" Found!");
				return FontList.get(i).getData();
			}
		}
		System.out.println("Warning!/tGlobalResources - Resource "+fontName+" Does Not Exist!");
		return null;
	}
	
}
